import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "",
      name: "home",
      component: () => import("@/views/HomeView.vue"),
      redirect: "/index",
      children: [
        {
          path: "/index",
          name: "index",
          component: () => import("@/views/home/index.vue"),
        },
        {
          path: "/learning",
          name: "learning",
          component: () => import("@/views/learning/index.vue"),
        },
        {
          path: "/test",
          name: "test",
          component: () => import("@/views/test/index.vue"),
        },
        {
          path: "/training",
          name: "training",
          component: () => import("@/views/training/index.vue"),
        },
        {
          path: "/my",
          name: "my",
          component: () => import("@/views/my/home.vue"),
          redirect: "/my/index",
          children: [
            {
              path: "index",
              name: "Index",
              component: () => import("@/views/my/index.vue"),
            },
            {
              path: "login",
              name: "login",
              component: () => import("@/views/my/login.vue"),
            },
          ],
        },
      ],
    },
  ],
});

export default router;
